<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>  

<script type="text/javascript">
	$(function(){
		var searchClick = 0;
		
		$('#delete').click(function(){
			if(confirm('정말 삭제하시겠습니까? \n 복구가 불가능합니다.')){
				$(location).attr('href','deleteMember.do');
			}else{
				return false;
			}
		});
		
		$('#searchAddr').click(function(){
			searchClick = 1;
			//주소 찾기 팝업
			window.open('searchAddr.do','주소 찾기','top=200px,left=600px,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=450');
		});
		 
		//이벤트 연결
		$('#joinForm').submit(function(event){
			if(searchClick == 0 && $('#zipcode').val() == null){
				$('#search_signed').html('주소 찾기 필수!!').css('color','red');
				return false;
			}
			if(isNaN($('#phone').val())){
				$('#int_signed').html('숫자만 입력해주세요.').css('color','red');
				return false;
			}
		});
	}); 
</script>

<div class="container">
<!-- 개인정보수정 창 -->
<div id="info">
	<h2><img src="./image/title_img6.jpg"/></h2>
</div>

	<div id="memberModify"><br><br>
	<form:form commandName="memberCommand" role="form" class="form-horizontal" 
				name="memberModifyForm" id="memberModifyForm" action="memberModify.do" method="post">
		<form:errors element="div"/>
			<div class="form-group">
				<div id="title" class="col-md-12 col-xs-12 col-sm-12" align="center">
					<spring:message code="member.modifyMember.title"/>
				</div>
			</div>
			
			<form:hidden path="id"/>
			
			<div class="form-group">
				<label for="password" class="col-md-3 col-xs-3 col-sm-3 control-label">비밀번호</label>
				<div id="password" class="col-md-5 col-xs-5 col-sm-5">
					<form:password path="password" class="form-control" showPassword="false"/>
				</div>
				<div class="col-md-4 col-xs-4 col-sm-4">
					<font color="red"><form:errors path="password"/></font> <br>
				</div>
			</div>
			<div class="form-group">
				<label for="confirmPassword" class="col-md-3 col-xs-3 col-sm-3 control-label">비밀번호확인</label>
				<div class="col-md-5 col-xs-5 col-sm-5">
					<form:password path="confirmPassword" class="form-control" showPassword="false"/>		
				</div>
				<div class="col-md-4 col-xs-4 col-sm-4">
					<font color="red"><form:errors path="confirmPassword"/></font> <br>
				</div>
			</div>
			<div class="form-group">
				<label for="name" class="col-md-3 col-xs-3 col-sm-3 control-label">이름</label>
				<div class="col-md-5 col-xs-5 col-sm-5">
					<form:input path="name" class="form-control"/>
				</div>
				<div class="col-md-4 col-xs-4 col-sm-4">
					<font color="red"><form:errors path="name"/></font> <br>
				</div>
			</div>
			<div class="form-group">
				<label for="phone" class="col-md-3 col-xs-3 col-sm-3 control-label">전화번호</label>
				<div class="col-md-5 col-xs-5 col-sm-5">
					<form:input path="phone" class="form-control" maxlength="11" placeholder="-를 빼고 입력해주세요"/>
				</div>
				<div class="col-md-4 col-xs-4 col-sm-4">
					<span id="int_signed"></span>
					<font color="red"><form:errors path="phone"/></font> <br>
				</div>
			</div>
			<div class="form-group">
				<label for="zipcode" class="col-md-3 col-xs-3 col-sm-3 control-label">우편번호</label>
				<div class="col-md-3 col-xs-3 col-sm-3">
					<form:input path="zipcode" class="form-control" readonly="true"/>
				</div>
				<div class="col-md-2 col-xs-2 col-sm-2">
					<input type="button" class="btn btn-default" id="searchAddr" value="주소 찾기">
				</div>
				<div class="col-md-4 col-xs-4 col-sm-4">
					<span id="search_signed"></span>
					<font color="red"><form:errors path="zipcode"/></font> <br>
				</div>
			</div>
			<div class="form-group">
				<label for="addr1" class="col-md-3 col-xs-3 col-sm-3 control-label">주소</label>
				<div class="col-md-5 col-xs-5 col-sm-5">
					<form:input path="addr1" class="form-control" readonly="true"/>
				</div>
			</div>
			<div class="form-group">
				<label for="addr2" class="col-md-3 col-xs-3 col-sm-3 control-label">상세주소</label>
				<div class="col-md-5 col-xs-5 col-sm-5">
					<form:input path="addr2" class="form-control"/>
				</div>
				<div class="col-md-4 col-xs-4 col-sm-4">
					<font color="red"><form:errors path="addr2"/></font> <br>
				</div>
			</div>
			<div class="form-group">
				<label for="gender" class="col-md-3 col-xs-3 col-sm-3 control-label">성별</label>
				<div class="col-md-5 col-xs-5 col-sm-5">
					<form:radiobutton path="gender" value="남자" checked="true"/>남자 &nbsp;&nbsp;&nbsp;
					<form:radiobutton path="gender" value="여자" />여자
				</div>
			</div>
			<div class="form-group">
				<div class="col-md-12 col-xs-12 col-sm-12" align="center">
					<input type="submit" class="btn btn-default" value="수정">&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="button" class="btn btn-default" value="취소" onclick="location.href='myPage.do'">&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="button" id="delete" class="btn btn-primary" value="회원탈퇴">
				</div>
			</div>
	</form:form>
	</div>
</div>
